﻿/*----------------------------------------------------------------
//  <copyright file="UserEventData.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-12-13 14:29</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Identity
{
    #region "Identity错误信息描述的zh-Hans本地化"
    /// <summary>
    /// Identity错误信息描述的zh-Hans本地化
    /// </summary>
    public class IdentityErrorDescriberZhHans : IdentityErrorDescriber
    {
        #region "静态字段"
        #region "Identity错误信息字典"
        /// <summary>
        /// Identity错误信息字典
        /// </summary>
        public static readonly IDictionary<string, string> DescriptionDict = new Dictionary<string, string>()
        {
            { "ConcurrencyFailure", "乐观并发失败，对象已被修改。" },
            { "DefaultError", "发生了一个未知的错误。" },
            { "DuplicateEmail", "电子邮件“{0}”已被占用。" },
            { "DuplicateRoleName", "角色名称“{0}”已被占用。" },
            { "DuplicateUserName", "用户名“{0}”已被占用。" },
            { "InvalidEmail", "电子邮件“{0}”无效。" },
            { "InvalidManagerType", "类型{0}必须从{1}<{2}>派生。" },
            { "InvalidPasswordHasherCompatibilityMode", "提供的PasswordHasherCompatibilityMode无效。" },
            { "InvalidPasswordHasherIterationCount", "迭代计数必须是正整数。" },
            { "InvalidRoleName", "角色名称“{0}”无效。" },
            { "InvalidToken", "令牌Token无效。" },
            { "InvalidUserName", "用户名“{0}”无效，只能包含字母或数字。" },
            { "LoginAlreadyAssociated", "具有此登录名的用户已经存在。" },
            { "MustCallAddIdentity", "必须对服务集合调用AddIdEntity。" },
            { "NoPersonalDataProtector", "没有注册IPersonalDataProtector服务，这在ProtectPersonalData=true时是必需的。" },
            { "NoRoleType", "未指定RoleType，请尝试AddRoles<TRole>()。" },
            { "NoTokenProvider", "未注册名为“{1}”的IUserTwoFactorTokenProvider<{0}>。" },
            { "NullSecurityStamp", "用户安全标识不能为空。" },
            { "PasswordMismatch", "密码错误。" },
            { "PasswordRequiresDigit", "密码必须至少有一个数字('0'-'9')。" },
            { "PasswordRequiresLower", "密码必须至少有一个小写字母 ('a'-'z')。" },
            { "PasswordRequiresNonAlphanumeric", "密码必须至少有一个非字母数字字符。" },
            { "PasswordRequiresUniqueChars", "密码必须至少使用{0}不同的字符。" },
            { "PasswordRequiresUpper", "密码必须至少有一个大写字母 ('A'-'Z')。" },
            { "PasswordTooShort", "密码必须至少是{0}字符。" },
            { "RecoveryCodeRedemptionFailed", "恢复代码赎回失败。" },
            { "RoleNotFound", "角色{0}不存在。" },
            { "StoreNotIProtectedUserStore", "Store不实现IProtectedUserStore<TUser>，这在ProtectPersonalData=true时是必需的。" },
            { "StoreNotIQueryableRoleStore", "Store不实现IQueryableRoleStore<TRole>。" },
            { "StoreNotIQueryableUserStore", "Store不实现IQueryableUserStore<TUser>。" },
            { "StoreNotIRoleClaimStore", "Store不实现IRoleClaimStore<TRole>。" },
            { "StoreNotIUserAuthenticationTokenStore", "存储不实现IUserAuthenticationTokenStore<User>。" },
            { "StoreNotIUserAuthenticatorKeyStore", "存储不实现IUserAuthenticatorKeyStore<User>。" },
            { "StoreNotIUserClaimStore", "Store不实现IUserClaimStore<TUser>。" },
            { "StoreNotIUserConfirmationStore", "Stand不实现iUSER确认存储<TUser>。" },
            { "StoreNotIUserEmailStore", "Store不实现IUserEmailStore<TUser>。" },
            { "StoreNotIUserLockoutStore", "Store不实现IUserLockoutStore<TUser>。" },
            { "StoreNotIUserLoginStore", "Store不实现IUserLoginStore<TUser>。" },
            { "StoreNotIUserPasswordStore", "Store不实现IUserPasswordStore<TUser>。" },
            { "StoreNotIUserPhoneNumberStore", "存储不实现IUserPhoneNumberStore<TUser>。" },
            { "StoreNotIUserRoleStore", "Store不实现IUserRoleStore<TUser>。" },
            { "StoreNotIUserSecurityStampStore", "存储不实现IUserSecurityStampStore<TUser>。" },
            { "StoreNotIUserTwoFactorRecoveryCodeStore", "Store不实现IUserTwoFactorRecoveryCodeStore<TUser>。" },
            { "StoreNotIUserTwoFactorStore", "Store不实现IUserTwoFactorStore<TUser>。" },
            { "UserAlreadyHasPassword", "用户已经设置了密码。" },
            { "UserAlreadyInRole", "用户已经处于角色“{0}”中。" },
            { "UserLockedOut", "用户已被锁定，暂时无法登录。" },
            { "UserLockoutNotEnabled", "此用户未启用锁定。" },
            { "UserNameNotFound", "用户{0}不存在。" },
            { "UserNotInRole", "用户不在角色“{0}”中。" },
        };
        #endregion

        #endregion

        #region "方法"
        #region "返回一个默认的<see cref="IdentityError" />"
        /// <summary>
        /// 返回一个默认的<see cref="IdentityError" />
        /// </summary>
        /// <returns>一个默认的<see cref="IdentityError" /></returns>
        public override IdentityError DefaultError()
        {
            IdentityError error = base.DefaultError();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示并发失败"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示并发失败
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示并发失败</returns>
        public override IdentityError ConcurrencyFailure()
        {
            IdentityError error = base.ConcurrencyFailure();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示密码不匹配"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示密码不匹配
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示密码不匹配</returns>
        public override IdentityError PasswordMismatch()
        {
            IdentityError error = base.PasswordMismatch();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示无效的令牌"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示无效的令牌
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示无效的令牌</returns>
        public override IdentityError InvalidToken()
        {
            IdentityError error = base.InvalidToken();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示恢复代码未实现"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示恢复代码未实现
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示恢复代码未实现</returns>
        public override IdentityError RecoveryCodeRedemptionFailed()
        {
            IdentityError error = base.RecoveryCodeRedemptionFailed();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示外部登录已与帐户关联"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示外部登录已与帐户关联
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />指示外部登录已与帐户关联</returns>
        public override IdentityError LoginAlreadyAssociated()
        {
            IdentityError error = base.LoginAlreadyAssociated();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定的用户<paramref name="userName" />无效"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定的用户<paramref name="userName" />无效
        /// </summary>
        /// <param name="userName">无效的用户名</param>
        /// <returns>一个<see cref="IdentityError" />指示指定的用户<paramref name="userName" />无效</returns>
        public override IdentityError InvalidUserName(string userName)
        {
            IdentityError error = base.InvalidUserName(userName);
            //error.Description = DescriptionDict[error.Code].FormatWith(userName);
            error.Description = I18N.T(DescriptionDict[error.Code], userName);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定的<paramref name="email" />无效"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定的<paramref name="email" />无效
        /// </summary>
        /// <param name="email">无效的电子邮件</param>
        /// <returns>一个<see cref="IdentityError" />指示指定的<paramref name="email" />无效</returns>
        public override IdentityError InvalidEmail(string email)
        {
            IdentityError error = base.InvalidEmail(email);
            //error.Description = DescriptionDict[error.Code].FormatWith(email);
            error.Description = I18N.T(DescriptionDict[error.Code], email);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示指定的<paramref name="userName" />已经存在"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示指定的<paramref name="userName" />已经存在
        /// </summary>
        /// <param name="userName">已存在的用户名</param>
        /// <returns>一个<see cref="IdentityError" />表示指定的<paramref name="userName" />已经存在</returns>
        public override IdentityError DuplicateUserName(string userName)
        {
            IdentityError error = base.DuplicateUserName(userName);
            //error.Description = DescriptionDict[error.Code].FormatWith(userName);
            error.Description = I18N.T(DescriptionDict[error.Code], userName);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定的<paramref name="email" />已与帐户关联"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定的<paramref name="email" />已与帐户关联
        /// </summary>
        /// <param name="email">已与帐户关联的电子邮件</param>
        /// <returns>一个<see cref="IdentityError" />指示指定的<paramref name="email" />已与帐户关联</returns>
        public override IdentityError DuplicateEmail(string email)
        {
            IdentityError error = base.DuplicateEmail(email);
            //error.Description = DescriptionDict[error.Code].FormatWith(email);
            error.Description = I18N.T(DescriptionDict[error.Code], email);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称无效"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称无效
        /// </summary>
        /// <param name="role">无效角色</param>
        /// <returns>一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称无效</returns>
        public override IdentityError InvalidRoleName(string role)
        {
            IdentityError error = base.InvalidRoleName(role);
            //error.Description = DescriptionDict[error.Code].FormatWith(role);
            error.Description = I18N.T(DescriptionDict[error.Code], role);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称已存在"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称已存在
        /// </summary>
        /// <param name="role">重复的角色</param>
        /// <returns>一个<see cref="IdentityError" />指示指定的<paramref name="role" />名称已存在</returns>
        public override IdentityError DuplicateRoleName(string role)
        {
            IdentityError error = base.DuplicateRoleName(role);
            //error.Description = DescriptionDict[error.Code].FormatWith(role);
            error.Description = I18N.T(DescriptionDict[error.Code], role);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示用户已经有密码"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示用户已经有密码
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示用户已经有密码</returns>
        public override IdentityError UserAlreadyHasPassword()
        {
            IdentityError error = base.UserAlreadyHasPassword();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示用户锁定未启用"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示用户锁定未启用
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />指示用户锁定未启用</returns>
        public override IdentityError UserLockoutNotEnabled()
        {
            IdentityError error = base.UserLockoutNotEnabled();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示用户已经在指定的<paramref name="role" />中"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示用户已经在指定的<paramref name="role" />中
        /// </summary>
        /// <param name="role">重复的角色</param>
        /// <returns>一个<see cref="IdentityError" />表示用户已经在指定的<paramref name="role" />中</returns>
        public override IdentityError UserAlreadyInRole(string role)
        {
            IdentityError error = base.UserAlreadyInRole(role);
            //error.Description = DescriptionDict[error.Code].FormatWith(role);
            error.Description = I18N.T(DescriptionDict[error.Code], role);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />表示用户不在指定的<paramref name="role" />中"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />表示用户不在指定的<paramref name="role" />中
        /// </summary>
        /// <param name="role">重复的角色</param>
        /// <returns>一个<see cref="IdentityError" />表示用户不在指定的<paramref name="role" />中</returns>
        public override IdentityError UserNotInRole(string role)
        {
            IdentityError error = base.UserNotInRole(role);
            //error.Description = DescriptionDict[error.Code].FormatWith(role);
            error.Description = I18N.T(DescriptionDict[error.Code], role);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示指定<paramref name="length" />的密码不符合最小长度要求"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示指定<paramref name="length" />的密码不符合最小长度要求
        /// </summary>
        /// <param name="length">长度不够长</param>
        /// <returns>一个<see cref="IdentityError" />指示指定<paramref name="length" />的密码不符合最小长度要求</returns>
        public override IdentityError PasswordTooShort(int length)
        {
            IdentityError error = base.PasswordTooShort(length);
            //error.Description = DescriptionDict[error.Code].FormatWith(length);
            error.Description = I18N.T(DescriptionDict[error.Code], length);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示密码不符合<paramref name="uniqueChars" />最小唯一要求"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示密码不符合<paramref name="uniqueChars" />最小唯一要求
        /// </summary>
        /// <param name="uniqueChars">必须使用的不同字符数</param>
        /// <returns>一个<see cref="IdentityError" />指示密码不符合<paramref name="uniqueChars" />最小唯一要求</returns>
        public override IdentityError PasswordRequiresUniqueChars(int uniqueChars)
        {
            IdentityError error = base.PasswordRequiresUniqueChars(uniqueChars);
            //error.Description = DescriptionDict[error.Code].FormatWith(uniqueChars);
            error.Description = I18N.T(DescriptionDict[error.Code], uniqueChars);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示输入的密码不包含密码策略所需的非字母数字字符"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示输入的密码不包含密码策略所需的非字母数字字符
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示输入的密码不包含非字母数字字符</returns>
        public override IdentityError PasswordRequiresNonAlphanumeric()
        {
            IdentityError error = base.PasswordRequiresNonAlphanumeric();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示输入的密码不包含数字字符，这是密码策略所必需的"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示输入的密码不包含数字字符，这是密码策略所必需的
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示输入的密码不包含数字字符</returns>
        public override IdentityError PasswordRequiresDigit()
        {
            IdentityError error = base.PasswordRequiresDigit();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示输入的密码不包含小写字母，这是密码策略所必需的"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示输入的密码不包含小写字母，这是密码策略所必需的
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示输入的密码不包含小写字母</returns>
        public override IdentityError PasswordRequiresLower()
        {
            IdentityError error = base.PasswordRequiresLower();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion
        #region "返回一个<see cref="IdentityError" />指示输入的密码不包含大写字母，这是密码策略所必需的"
        /// <summary>
        /// 返回一个<see cref="IdentityError" />指示输入的密码不包含大写字母，这是密码策略所必需的
        /// </summary>
        /// <returns>一个<see cref="IdentityError" />表示输入的密码不包含大写字母</returns>
        public override IdentityError PasswordRequiresUpper()
        {
            IdentityError error = base.PasswordRequiresUpper();
            //error.Description = DescriptionDict[error.Code];
            error.Description = I18N.T(DescriptionDict[error.Code]);
            return error;
        }
        #endregion

        #endregion

    }
    #endregion

}
